{% extends "base.html" %}
{% block title %}Seznam pisnih ocen izpita{% endblock %}

{% block js %}

<script type="text/javascript">

$(document).ready(function(){
  $("#id_exam").change(function(){
    selected_value = $('#id_exam option:selected').val();
    if (selected_value != undefined && selected_value != "") {
      document.location="/exams/exam_partial_list/{{ professor.pk }}/"+selected_value+"/";
    }
  });
  })
  
</script>

{% endblock %}

{% block content %}
{% if only_search %}

<script type="text/javascript" src="{{ MEDIA_URL }}js/search.js"></script>
<script type="text/javascript">

$(document).ready(function(){    
    search_setcb('professor',function(professor){
      url = '/exams/exam_partial_list/'+professor.pk+'/';
      document.location = url;
    });
    
});
</script>
{% include "snippets/professor/search.htm" %}
{% else %}
<p class="hide_print">
  <b>Izbrani profesor: </b> {{ professor }}<br />
  <a href="/exams/exam_partial_list/">Ponovna izbira profesorja</a>
</p><br />
<div class="form">
	{{ form.as_p }}
</div>
{% if data != None %}
{% include "snippets/core/print.htm" %}

<h2>Seznam pisnih ocen izpita</h2>
<p><b>seznam pisnih ocen za izpit:</b> {{ exam }}</p>
<p><b>Izvajalci: </b> {{ exam.show_professor }} </p>
{% csrf_token %}
<table class="list" style="width: 90%">
  <tr>
    <th class="num">#</th>
    <th>Vpisna številka</th>
	<th>Priimek in ime</th>
    <th>Št. polaganj</th>
	<th>Študijsko leto</th>
	<th>Št. točk</th>
	<th>Točk ostalo</th>
  </tr>
  {% for student in data %}
  <tr>
	<td class="num">{{ forloop.counter }}</td>
	<td>{{ student.student.enrollment_number }}</td>
	<td>{{ student.student.user.last_name }} {{ student.student.user.first_name }}</td>
	<td>{{ student.num_app }}</td>
	<td>{{ student.exam.subject.school_year_start }} / {{ student.exam.subject.school_year_end }}</td>
  {% if student.exam_grade == 0 or student.practice_grade == 0 %}
    <td colspan="2" style="padding-left: 70px"><b>VP</b></td>     
  {% else %}
      <td>
      {% if student.points == None %}
      <i>Ni točk</i>
      {% else %}
      {{ student.points }}
      {% endif %}
      </td>
      <td>
      {% if student.points_rest == None %}
      <i>Ni točk</i>
      {% else %}
      {{ student.points_rest }}
      {% endif %}
      </td> 
  {% endif %}
  </tr>
  {% endfor %}
</table>
{% endif %}
{% endif %}
{% endblock %}